<?php
declare(strict_types=1);
namespace Field;

class SysDictConst
{
    public const pk='DictID';
    public const index=['DictID'];
	public const fields=['DictID','DictKey','DictName','Content','Status'];
	public const comment=['DictID'=>'','DictKey'=>'字典Key','DictName'=>'字典名字','Content'=>'字典配置','Status'=>'状态(1:禁用,2:启用)'];
	/*
    * @Field DictID
    * @Type int(10) unsigned
    * @Collation 
    * @Null NO
    * @Key PRI
    * @Default 
    * @Extra auto_increment
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const DictID = 'DictID';
    /*
    * @Field DictKey
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const DictKey = 'DictKey';
    /*
    * @Field DictName
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 字典名字
    */
    public const DictName = 'DictName';
    /*
    * @Field Content
    * @Type varchar(2000)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 字典配置
    */
    public const Content = 'Content';
    /*
    * @Field Status
    * @Type int(10) unsigned
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 0
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 状态(1:禁用,2:启用)
    */
    public const Status = 'Status';
}

class SysDictColumns
{
public  int $DictID;
   public  ?string $DictKey='';
   public  ?string $DictName='';
   public  ?string $Content='';
   public  int $Status=0;
	public function toArray():array
	{
		return [
'DictID'=>$this->DictID,
    'DictKey'=>$this->DictKey,
    'DictName'=>$this->DictName,
    'Content'=>$this->Content,
    'Status'=>$this->Status,        ];
	}
}

class SysDictRow
{
	public SysDictColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'DictID' => $this->data->DictID,
        'DictKey' => $this->data->DictKey,
        'DictName' => $this->data->DictName,
        'Content' => $this->data->Content,
        'Status' => $this->data->Status, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new SysDictColumns();
        isset($data['DictID']) && $this->data->DictID = (int)$data['DictID'];
           isset($data['DictKey']) && $this->data->DictKey = (string)$data['DictKey'];
           isset($data['DictName']) && $this->data->DictName = (string)$data['DictName'];
           isset($data['Content']) && $this->data->Content = (string)$data['Content'];
           isset($data['Status']) && $this->data->Status = (int)$data['Status'];
    }
}
?>